<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix = "c"  uri = "http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix = "fn" uri = "http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<link rel="stylesheet" type="text/css"  href="css/bootstrap.min.css"/>
	<title>凯胜项目管理系统</title>
	<style type="text/css">
		body{
			padding-top:70px;
		}
	</style>
</head>
<body class="body">
	<%@include file="same2.jsp" %>
	<div class="container">
		<div class="row">
			<%@include file="same.jsp" %>
			<div class="span9" >
				<div class="clear"></div>
				 <ul class="breadcrumb" style="margin-bottom:0px;border-radius: 3px 3px 0 0;margin-top:10px">
					<li class="active">
						<a><i class="icon-folder-open"></i>资料</a>
					</li>
					<li style="float:right"><i class="icon-plus"></i><a href="document.jspx?method=toNewDocument" class="link-black">分享新资料</a></li>
				</ul>
				<c:choose>
					<c:when test="${empty requestScope.DocuList.list}">
						<div class="wall" style="border-top:none; border:1px solid #dddddd ;padding-top:50px;padding-bottom:50px;padding-left:50px">还没有关于你参与项目的资料！</div>
					</c:when>
					<c:otherwise>
						<div class="wall" style="border-top:none; border:1px solid #dddddd ">
							<c:forEach items ="${requestScope.DocuList.list}" var ="item">
								<div style="margin:20px">						
									<blockquote>
									<div><a href="document.jspx?method=toDocument&id=${item.document.id}"><h4>${item.document.title }</h4></a></div>
										  <p style="font-size:14px">${item.document.content}</p>
										  <small>${item.document.user.username}${item.document.time}&nbsp;&nbsp;&nbsp;&nbsp;<a href = "document.jspx?method=toDocument&id=${item.document.id}"style = "cursor:pointer" class = "pinglun">[我要评论]</a></p></small>
										  
										
											<c:if test="${item.document.user.id == sessionScope.user.id && item.document.result == 1}">
													
												<p><a href="document.jspx?method=edit&id=${item.document.id}" ><i class="icon-pencil"></i></a><a href = "#" id = "del" style = "cursor:pointer" ><i class="icon-trash"></i></a><span>    </span>
												<div class = "modal hide "  id="mymodal" style = "width:400px">
												  			<div class = "modal-header">
														<input type="button" value="x" style = 'color:black' class = "close" data-dismiss = "modal"/>
														<h3>删除资料</h3>
													</div>
															<div class = "modal-body" style = "text-align:center;height:20px;margin-top:10px">
																	<div >删除后将无法恢复，您确定要删除此资料${item.document.title }吗？</div>		
															</div>
															<div class = "modal-footer">
																<a href="href="document.jspx?method=del" class = "btn btn-primary" >是</a>
																<a class = "btn "  data-dismiss = "modal">否</a>
															</div>
													</div>
												
											</c:if>
										
										  	
										  	
										  	
										  	
										  
										  
									</blockquote>						
								</div>	
							</c:forEach>
							
							                                                                                                                                                                                                          	
						<div style="margin-top:2px;margin-right:10px"  class="pagination pagination-right">
					 <ul>
					 
					<c:choose>
						<c:when test="${ requestScope.DocuList.totalPage == 1}">
							
						</c:when>
						<c:when test="${ requestScope.DocuList.totalPage > 1}">
							<c:choose>
							<c:when test="${DocuList.pageNum == 1}">
								<li><a href="#">Prev</a></li>
								<li class = "active"><a>1</a></li>
								<li ><a href = "document.jspx?p=2">2</a></li>
								<li><a>...</a></li>	
								<li><a href="#">Next</a></li>			
							</c:when>
							<c:when test="${DocuList.pageNum == 2}">
								<li><a href="document.jspx?p=${DocuList.pageNum-1}">Prev</a></li>
								<li ><a href = "document.jspx?p=1">1</a></li>
								<li class = "active"><a href = "document.jspx?p=2">2</a></li>
								<li><a>...</a></li>
								<c:choose>
								<c:when test="${DocuList.pageNum == DocuList.totalPage }">
									<li><a href="#">Next</a></li>
								</c:when>
								<c:otherwise>
									<li><a href="document.jspx?p=${DocuList.pageNum+1}">Next</a></li>
								</c:otherwise>
								</c:choose>				
							</c:when>	
							<c:when test="${DocuList.pageNum > 2}">
								<li><a href="document.jspx?p=${DocuList.pageNum-1}">Prev</a></li>
								<li ><a href = "document.jspx?p=1">1</a></li>
								<li ><a href = "document.jspx?p=2">2</a></li>
								<li><a>...</a></li>	
								<li class = "active"><a >${DocuList.pageNum}</a></li>
								<c:choose>
								<c:when test="${DocuList.pageNum == DocuList.totalPage }">
									<li><a href="#">Next</a></li>
								</c:when>
								<c:otherwise>
									<li><a href="document.jspx?p=${DocuList.pageNum+1}">Next</a></li>
								</c:otherwise>
								</c:choose>		
							</c:when>	
							</c:choose>	
						</c:when>
					</c:choose>	
					<li><a>共${DocuList.totalPage}页</a></li>
					</ul></div>	
					</c:otherwise>	
					</c:choose>	
			</div>	
			</div>	
		</div>
	</div>
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			$("#myid li").eq(4).addClass("active");
			$("#myid i").eq(2).addClass("icon-white");
			$("#del").click(function (){
				$("#mymodal").modal("show");
			
			});
		});
		
	</script>	
</body>
</html>